var t = getApp();

Page({
    data: {
        list: [],
        tag: "all",
        current_page: 1,
        isLoadMore: !0,
        last_page: 0
    },
    onLoad: function(t) {
        this.getData();
    },
    getData: function() {
        var a = this, i = {};
        this.options.tag && "all" != this.options.tag && (i.put_in_type = "video" == this.options.tag ? "2" : "1", 
        i.put_in_id = this.options.id);
        var n = t.getNetAddresss("plugin.ad-serving.frontend.advertising.index.getList");
        t._postNetWork({
            url: n,
            data: i,
            success: function(t) {
                var i = t.data;
                1 == i.result ? a.setData({
                    list: i.data.list.data,
                    current_page: i.data.list.current_page,
                    last_page: i.data.list.last_page
                }) : wx.showToast({
                    title: i.msg,
                    icon: "none",
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getMore: function() {
        var a = this, i = {};
        this.options.tag && "all" != this.options.tag && (i.put_in_type = "video" == this.options.tag ? "2" : "1", 
        i.put_in_id = this.options.id), i.page = this.data.page;
        var n = t.getNetAddresss("plugin.ad-serving.frontend.advertising.index.getList");
        t._getNetWork({
            url: n,
            data: i,
            success: function(t) {
                var i = t.data;
                1 == i.result ? a.setData({
                    list: that.data.info.concat(i.data.list.data),
                    current_page: i.data.current_page,
                    last_page: i.data.last_page
                }) : wx.showToast({
                    icon: "none",
                    title: i.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    gotoADPlay: function(t) {
        var a = t.currentTarget.dataset, i = Math.ceil((a.index + 1) / 15);
        wx.navigateTo({
            url: "/packageH/Advertising/advertisingPlayPage/advertisingPlayPage?aid=" + a.id + "&tag=" + this.options.tag + "&id=" + this.options.id + "&page=" + i
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (!(this.data.current_page >= this.data.last_page)) {
            var t = this.data.page + 1;
            this.setData({
                page: t
            }), this.getMore();
        }
    },
    onShareAppMessage: function() {}
});